5. Direct vs. Serviced Connections
You may also consider
developing Azure services to keep the database connection to a local
network, and send the data back to the client using SOAP or REST
messages. If your Azure services are deployed in the same region as
your SQL Azure databases, the database connection is made from the same
datacenter and performs much faster. However, sending data back to the
consumer using SOAP or REST may not necessarily improve performance;
you're now sending back XML instead of raw data packets, which implies
a larger bandwidth footprint. Finally, you may consider writing stored
procedures to keep some of the business logic as close to the data as
possible.
Figure 2
shows the two different ways an application can retrieve data stored in
a SQL Azure database. A direct connection can be established to the
database from the application, in which case the application issues
T-SQL statements to retrieve data. A serviced connection can be made by
creating and deploying custom SOAP or REST services on Windows Azure,
which in turn communicate to the database. In this case, the
application requests data through web services deployed in Azure.
Keep in mind that you can
design an application to use both connection methods. You may determine
that your application needs to connect directly when archiving data,
while using services to perform more complex functions.
6. Pricing
Pricing of a hosted
environment isn't usually considered a factor when it comes to standard
application design. However, in the case of cloud computing, including
Azure, you need to keep in mind that your application's performance and
overall design have a direct impact on your monthly costs.
For example, you incur
network and processing fees whenever you deploy and use Azure services.
Although this is true, at the time of this writing the data traffic
between a Windows Azure application or service and a SQL Azure database
is free within the same geographic location.
Pricing may affect your
short-term application design choices, but you should keep in mind that
Microsoft may change its pricing strategy at any time. As a result,
although pricing is an important consideration especially for projects
on limited budget, long-term viability of a design should be more
important than short-term financial gains.
If you're designing an
application to live in the Azure world and you depend on this
application to generate revenue, you must ensure that your pricing
model covers the resulting operational costs. For example, your
application should be designed from the ground up with billing
capabilities in mind if you intend to charge for its use.
Another factor related to
pricing is that your SQL Azure database cost consists of a monthly fee
and a usage fee. The monthly fee is prorated, so if you create a
database at 1pm and drop it at 2pm the same day, you're charged a
fraction of the monthly fee, plus the usage fee. The usage fee is
strictly limited to bandwidth consumption: CPU utilization, I/O
consumption, and your database's memory footprint aren't factors in the
usage fee (see Figure 3). However, your database connection may be throttled if your CPU, I/O, and/or memory consumption reaches specific thresholds.
In summary, you can
consider moving certain CPU-intensive activities (within reason) on the
SQL Azure database without being charged. You may, for instance,
perform complex joins that use large datasets in a stored procedure and
return a few summary rows to the consumer as a way to minimize your
usage fee.
7. Security
It goes without saying
that security may be a concern for certain types of applications;
however, these concerns are similar to those that companies face when
using traditional hosting facilities. The question that comes to mind
when considering security is related to the lack of control over data
privacy. In addition, certain limitations may prevent certain kinds of
monitoring, which automatically rules out the use of SQL Azure for
highly sensitive applications unless the sensitive data is fully
encrypted on the client side.
As a result, encryption may
become an important part of your design decision. And if you decide to
encrypt your data, where will the encryption take place? Although the
connection link is encrypted between your application code and SQL
Azure, the data itself isn't encrypted when it's stored in SQL Azure.
You may need to encrypt your data in your application code before
sending it over the public Internet so that it's stored encrypted.
Encryption is good for data
privacy, but it comes with a couple of downsides: slower performance
and difficulty in searching for data. Heavy encryption can slow down an
application, and it's notoriously difficult to search for data that is
encrypted in a database.
8. Review of Design Factors
So far, you're seen a few considerations that can impact your design choices. Table 1
provides a summary. Some of the considerations are related to
opportunities that you may be able to take advantage of; others are
limitations imposed by the nature of cloud computing or specifically by
the Azure platform.
As you design applications,
make sure you evaluate whether specific Azure limitations discussed in
this book still apply—the Azure platform is likely to change quickly in
order to respond to customer demands.
Table 1. Summary of design factors
Opportunities | Limitations |
---|
Offsite storage | Limited amount of storage |
Elastic cost | Performance |
Instant provisioning | Backups |
SQL Data Sync | Security concerns |
High availability | |